var stylejson = new Array();
var typejson = new Array();
$(function () {
    $.ajax({
        url: "./goImage/initImgPage", //请求的url地址
        xhrFields: {
            withCredentials: true
        },
        dataType: "json", //返回格式为json
        type: "GET", //请求方式
        processData: false, //对表单data数据是否进行序列化
        contentType: false, //dataType设置你收到服务器数据的格式
        headers: {
            'Content-Type': 'application/json'
        },
        beforeSend: function() {
            //请求前的处理
        },
        success: function(data) {
            if(data.status==0){
                // top.location.href = "../../login.html";
                window.location.href="./login.html";
            }else{
                var json = JSON.parse(data.data)
                var tempstylejson = json.data;
                var temptypejson = json.data2;
                for(var i=0;i<tempstylejson.length;i++){
                    var temp = {
                        value: tempstylejson[i].Style,
                        label: tempstylejson[i].Style
                    };
                    stylejson.push(temp)
                }
                for(var i=0;i<temptypejson.length;i++){
                    var temp = {
                        value: temptypejson[i].Type,
                        label: temptypejson[i].Type
                    };
                    typejson.push(temp)
                }
            }
        },
        complete: function() {
            //请求完成的处理
        },
        error: function() {}
    });
})

var pageSize = 99999999;
var vm = new Vue({
    el: "#app",
    data:function(){
        return{
            StyleList:stylejson,
            Style:"",
            TypeList:typejson,
            Type:"",
            //图片展示
            imageList:[],
            //图片展示end
            stripe:true,
            Proinfo: false,
            image:{
                PName:"",
                Type:"",
                Style:"",
                Province:"",
                FName:"",
                IUrl:""
            }
        }
    },

    methods: {
        ok () {
        },
        cancel () {
        },
        querytable(){
            var self = this;
            var Style = this.Style;
            var Type = this.Type;
            var jsondata={"Style": Style, "Type":Type};
            var data_json = JSON.stringify(jsondata);
            $.ajax({
                url: "./goImage/queryAllImageByStyleAndType", //请求的url地址
                dataType: "json", //返回格式为json
                async:false,
                data: data_json, //参数值
                type: "POST", //请求方式
                processData: false, //对表单data数据是否进行序列化
                contentType: false, //dataType设置你收到服务器数据的格式
                headers: {
                    'Content-Type': 'application/json'
                },
                success: function(data) {
                    self.imageList = eval(data.data);
                },
                error: function() {},
            });
        },
        OpenProinfo(PName,Type,Style,Province,FName,IUrl){
            this.Proinfo = true;
            this.image.PName = PName;
            this.image.Type = Type;
            this.image.Style = Style;
            this.image.Province = Province;
            this.image.FName = FName;
            this.image.IUrl = IUrl;
        },

    }
})